//使用ckfinder上传

$("#ck_thumb_upload").click(function () {
    CKFinder.modal({
        chooseFiles: true,
        language: 'zh-cn',
        onInit: function (finder) {
            finder.on('files:choose', function (evt) {
                var url = evt.data.files.first().getUrl();
                $("input[name='thumb']").val(url);
                $("#img_show").attr('src', url);
            });

            finder.on('file:choose:resizedImage', function (evt) {
                var url = evt.data.resizedUrl;
                $("input[name='thumb']").val(url);
                $("#img_show").attr('src', url);
            });
        }
    });
});

//使用ckfinder上传
$("#ck_local_upload").click(function () {
    CKFinder.modal({
        chooseFiles: true,
        language: 'zh-cn',
        onInit: function (finder) {
            finder.on('files:selected', function (evt) {
                var urls=[];
                evt.data.files.each(function (f) {
                    urls.push(f.getUrl());
                });
                $("#urls").text(urls.join('\n'));

            });

            finder.on('file:choose:resizedImage', function (evt) {
                var url = evt.data.resizedUrl;
                $("#urls").text(url);
            });

            /*finder.on('folder:selected', function (evt) {
                var name=evt.data.folder.attributes.name;
                var data={
                    name:name
                }
                var _this=$(this);
                $.ajax({
                    type: "post",
                    url: "/video/get_Local_url",
                    data: data,
                    success:function (data) {
                        console.log(data);
                        $('#urls').html(data.join('\n'));
                    }
                });
            });*/
        }
    });
});

